import Vue from "vue";
import VueRouter from "vue-router";
import Test from '../views/test'
import Home from '../views/home/index'
import BookUp from '../views/home/bookUp/index'
import CvList from '../views/home/cvList/index'
import HearList from '../views/home/hearList/index'
import Message from '../views/home/message/index'
import MusicDown from '../views/home/musicDown/index'
import NarrationTask from '../views/home/narrationTask/index'
import PictureList from '../views/home/pictureList/index'
import UserManage from '../views/home/userManage/index'
import Login from '../views/user/login'
import ChangePassword from '../views/user/changPassword'
import defalt from '../views/404'

Vue.use(VueRouter);

const routes = [
    //首页
  {
    path: "/",
    name: "home",
    component: Home,
    redirect:{name:'userManage'},
    children:[
        // 图书上传
      {
        name:'bookUp',
        path:'/bookUp',
        component:BookUp,
        meta:{auth:true}
      },
        // cv列表
      {
        path: '/cvList',
        component: CvList
      },
        //审听列表
      {
        path: '/hearList',
        component: HearList
      },
        // 消息列表
      {
        path: '/message',
        component: Message
      },
        //音频下载
      {
        path: '/musicDown',
        component: MusicDown
      },
        //旁白任务
      {
        path: '/narrationTask',
        component: NarrationTask
      },
        //画本列表
      {
        path: '/pictureList',
        component: PictureList
      },
        //用户管理
      {
        name:'userManage',
        path: '/userManage',
        component: UserManage
      }
    ]
  },
    // 测试
  {
    path:"/test",
    name:'test',
    component: Test
  },
    // 登录
  {
    path: '/login',
    name: 'login',
    component: Login
  },
    // 修改密码
  {
    path: '/changePsd',
    name: 'changPassword',
    component: ChangePassword
  },
    // 404
  {
    path: '*',
    name: '404',
    component: defalt
  }


];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
